#ifndef dq_PropertyPage_h
#define dq_PropertyPage_h

#include <utility/String.h>

namespace serika
{
	namespace ut
	{
		class Config;
	}

	namespace dq
	{
		class PropertyTemplate;
		class Property;

		class PropertyPage : public CWnd
		{
			DECLARE_DYNAMIC(PropertyPage)

		public:
			PropertyPage(PropertyTemplate* tmpl);
			virtual ~PropertyPage();

			BOOL Create(CWnd* parent);

			virtual Property* CreateProperty() = 0;
			virtual void Active();
			virtual void Deactive();

		protected:
			virtual void OnInitialize() = 0;
			virtual void Layout();
			virtual void DoLayout(ut::Config* config) = 0;
			virtual const ut::Char* GetLayoutFilename() const = 0;
			void Layout(CWnd* wnd, ut::Config* config, const ut::Char* section);

			virtual void OnActivate() = 0;
			virtual void OnDeactivate() = 0;

			DECLARE_MESSAGE_MAP()

#ifdef LAYOUT_UI
			afx_msg void OnTimer(UINT_PTR nIDEvent);
#endif

		protected:
			PropertyTemplate* mTmpl;

			CFont mFont;

			void CreateStatic(CStatic& wnd, const ut::String& name, UINT id = 0xFFFF);
			void CreateEdit(CEdit& wnd, bool num, UINT id = 0xFFFF);
			void CreateRadioButton(CButton& wnd, const ut::String& name, bool groupStart, UINT id = 0xFFFF);
			void CreateCheckBox(CButton& wnd, const ut::String& name, UINT id = 0xFFFF);
			void CreateCombo(CComboBox& wnd, DWORD dropStyle, UINT id = 0xFFFF);
		};
	}
}

#endif
